home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
dev
/
basic
/
Mildred.lha
/
lha
/
FDsExample4.lha
/
2DPixelExplosion.asc
next >
Wrap
Text File
|
1999-01-21
|
3KB
|
100 lines
;Pixel Explosion Mildred Library Example.
;
;Programmed by : Mikkel Loekke, aka. FlameDuck.
;
;Please read the README file.
WBStartup
NoCli
degrad.q = Pi/180
NEWTYPE .point
x.q
y.q
angl.w
vel.q
End NEWTYPE
#numpnts=96*3 ; Change this for more or less points.
Dim pnt.point (#numpnts)
DEFTYPE.l
MCPU Processor ; Tell Mildred which CPU it should use.
Mc2pCPUmode Processor ; Tell Mildred which CPU it should use for c2p.
MReserveBitmaps 1 ; Tell Mildred that we're going to use 1 chunky bitmap.
MReservec2pWindows 1 ; Tell it we only need one c2p display.
MReserveShapes 1 ; Tell Mildred that we need a shape aswell.
InitPalette 0,256 ; Setup a grayscale palette.
For t.l=0To 255
AGAPalRGB 0,t,t,t,t
Next
.initgraphics
MBitmap 0,320,256 ; This will contain our chunky buffer.
Mc2pWindow 0,320,256 ; Setup structures for c2p conversions.
*pbb.l=AllocMem(320*256,$10002) ; Get some free CHIP memory
If *pbb.l ; and if we succeed
CludgeBitMap 0,320,256,8,*pbb ; make it a planar bitmap.
Else End
EndIf
Dim scrtaglst.TagItem(7) ; All this stuff sets up our
scrtaglst(0)\ti_Tag = #SA_Left ; Taglist for the screen we
scrtaglst(0)\ti_Data = 0 ; want.
scrtaglst(1)\ti_Tag = #SA_Depth
scrtaglst(1)\ti_Data = 8
scrtaglst(2)\ti_Tag = #SA_Width
scrtaglst(2)\ti_Data = 320
scrtaglst(3)\ti_Tag = #SA_Height
scrtaglst(3)\ti_Data = 256
scrtaglst(4)\ti_Tag = #SA_BitMap
scrtaglst(4)\ti_Data = Addr BitMap (0)
scrtaglst(5)\ti_Tag = #SA_ShowTitle
scrtaglst(5)\ti_Data = 0
scrtaglst(6)\ti_Tag = #SA_Draggable
scrtaglst(6)\ti_Data = 0
scrtaglst(7)\ti_Tag = #TAG_END ; The most important tag of them all.
ScreenTags 0,"MildredDEMO",&scrtaglst(0) ; Open our intuition screen.
ShowPalette 0 ; Attach our palette to the screen.
.goagain ; A Label that tells us where to go
; to reset all our variables
For t.l=0To #numpnts
pnt(t)\x=160
pnt(t)\y=128
pnt(t)\angl=Rnd(359)
pnt(t)\vel=Rnd(3)+1
Next
phase.w=0
Repeat ; Repeat our mainloop ....
Mc2p *pbb ; Convert our chunky buffer to
; our planar bitmap.
MCls ; Clear our chunky buffer
pntskip.w=0
For t=0 To #numpnts ; Boring math part. It's really
; not as complicated as it looks
If (pnt(t)\y>0 AND pnt(t)\y<256) AND (pnt(t)\x>0 AND pnt(t)\x<320)
MPlot pnt(t)\x,pnt(t)\y,255-phase
pnt(t)\x-Sin(pnt(t)\angl*degrad)*pnt(t)\vel
pnt(t)\y-Cos(pnt(t)\angl*degrad)*pnt(t)\vel
Else
pntskip+1
EndIf
Next
phase+4:If phase=256 Then pntskip=#numpnts
Until RawStatus($45) OR pntskip=#numpnts ; .... Until we press Escape, or the fade is complete.
If pntskip=#numpnts Then Goto goagain ; If the fade completed, reset variables, and go again.
End ; End our nice program.